<?php
/**
 * Created by PhpStorm
 * User: Jhinwy
 * Date: 2/24/25
 * Time: 2:39 PM
 */

namespace App\Http\Controllers\Admin;


use Illuminate\Http\Request;
use App\Services\LadingPageService;
use App\Http\Controllers\ResourceController;

class LadingPageController extends ResourceController
{
    protected $service;

    public function __construct(LadingPageService $service)
    {
        $this->service = $service;
    }


    public function getList(Request $request)
    {
        return $this->responseWithSuccess($this->service->getList($request->post()));
    }


    public function save(Request $request)
    {
        return $this->service->save($request->post()) ? $this->responseWithSuccess() : $this->responseWithError();
    }

    public function updateAudit(Request $request)
    {
        $id      = $request->post('id', 0);
        $isAudit = $request->post('is_audit', 0);

        return $this->service->updateAudit($id, $isAudit) ? $this->responseWithSuccess() : $this->responseWithError();
    }


    public function delete(Request $request)
    {
        return $this->service->delete($request->post('id')) ? $this->responseWithSuccess() : $this->responseWithError();
    }
}
